package com.saver.core.processor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class GenericBankProcessorSMS {
	
	public Double extraerImporte(String sms){
		String importe ="0.0";
		sms = sms.replace("\n", " ");
		Pattern p = Pattern.compile("(S/.|Importe)(\\s+)(((\\d+)|((\\d{1,3})(,\\d{1,3})+))(\\.)\\d+|\\d+)");
		Matcher m = p.matcher(sms);
		while (m.find()) { 
		    importe = m.group();
		}
		return Double.parseDouble(importe.replace(",", "").replace("S/. ", "").replace("Importe ", ""));
	}
}
